#include <stdio.h>
#include <stdlib.h>
#include "matrix.h"

int main()
{
	
	int n,m;
	float mA[N][N];
	float invA[N][N];	
	read_matrix(mA,&n,&m);

	Matrix A;
	Vector c;
	Vector x;

	A.rows = n;
	A.cols = m;
	A.elements = (float **)malloc(A.rows*sizeof(float *) );
	for(int i=0;i<A.rows;i++)
		A.elements[i] = (float *)malloc(A.cols*sizeof(float));

	for(int i=0;i<A.rows;i++)
	for(int j=0;j<A.cols;j++)
	A.elements[i][j] = mA[i][j];

	c.elements = (float *)malloc(A.cols*sizeof(float));
	c.dim = A.cols;
	printf("Enter C vector:\n");
	for(int i=0;i<c.dim;i++)
	{
		scanf("%f",&(c.elements[i]));
	}
	
	x.elements = (float *)malloc(A.cols*sizeof(float));


	if(solve_few_linear_eq(A,c,&x))
	{

		printf("One Solution is: \n");
		for(int i=0;i<x.dim;i++)
		printf("%10.3f\n",x.elements[i]);
	}
	else
	{
		printf("Error mentioned above\n");
	}
}
